%module TensorModule

%import "LibDL/global_typemaps.i"

SWIG_JAVABODY_PROXY(public, public, SWIGTYPE)
SWIG_JAVABODY_TYPEWRAPPER(public, public, public, SWIGTYPE)
//%typemap(javaconstruct) Tensor {
//    if(memory_allocated_ratio()>0.5){
//        System.gc();
//    }
//}

%import "LibDL/global_typemaps.i"
%import "LibDL/options/options.i"
%import "LibDL/TensorOptions/TensorOptions.i"
%{
#include "./LibDL/Tensor/Tensor.h"
#include "./LibDL/Tensor/Scalar.h"
%}

%nspace Tensor;
%nspace Scalar;

%include "./LibDL/Tensor/Tensor.h"
%include "./LibDL/Tensor/Scalar.h"

%template(StdVectorTensor) std::vector<Tensor>;
%template(StdPairTensor) std::pair<Tensor, Tensor>;
%template(tolist_long) Tensor::tolist_<int64_t>;
%template(tolist_double) Tensor::tolist_<double>;
%template(tolist_float) Tensor::tolist_<float>;
%template(tolist_int) Tensor::tolist_<int>;
%template(tolist_short) Tensor::tolist_<int16_t>;
